<template>
  <j-modal
    :title="title"
      :width="1200"
    :visible="visible"
    switchFullscreen
    :destroyOnClose="true"
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    okText="确定（F7）"
    cancelText="关闭（ESC）">
    <service-project-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :YXSdisableSubmit="YXSdisableSubmit"  :formBpm="formBpm" :formData="{dataId:formData.id,disabled:false}"></service-project-form>
  </j-modal>
</template>

<script>

  import ServiceProjectForm from './WhMedicalServiceProjectForm'
  import { otherModalKeyMinxin } from '@/mixins/otherModalKeyMinxin'

  export default {
    name: 'WhMedicalServiceProjectForm',
    mixins:[otherModalKeyMinxin],
    components: {
      ServiceProjectForm
    },
    data () {
      return {
        title:'',
        width:1200,
        visible: false,
        disableSubmit: false,
        formData:{},
        formBpm:false,
        YXSdisableSubmit:false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.formBpm =false
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.formBpm = true
        this.formData = record;
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.formData = {}
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>